home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3524 < prev    next >
Encoding:
Text File  |  1996-08-06  |  982 b   |  33 lines

  1. Path: damon.irf.uni.dortmund.de!broth
  2. From: rothert@damon.irf.uni-dortmund.de (Bernd Rothert)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: BORLAND C++ 4.5 wont add .1 and .9
  5. Date: Wed, 24 Jan 96 16:40:20 GMT
  6. Organization: Institute of Robotics Research
  7. Message-ID: <4e5njv$e9v@damon.irf.uni-dortmund.de>
  8. References: <corekinDLG8t4.3C5@netcom.com>
  9. NNTP-Posting-Host: broth.irf
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <corekinDLG8t4.3C5@netcom.com>,
  13.    corekin@netcom.com (david corekin) wrote:
  14. >I had some problems with floating point numbers as well.  In my
  15.  
  16. Today I discovered that my BC++ 4.5 doesn't even add 1+1 correctly - try:
  17.  
  18. #include <stdio.h>
  19. int one(void) { return 1; }
  20. int main(void)
  21. {
  22.     int zero = 0;
  23.     int two = (zero == 0) ? one()+1 : zero+1;
  24.     printf("one() plus 1 is %d\n", two);
  25.     return 0;
  26. }
  27.  
  28. After compiling with "bcc -ml bug21.c" (BC++ version 4.5) the program outputs:
  29.     one() plus 1 is 1
  30. which is not exactly what I whould expect...
  31.  
  32. Bernd
  33.